package com.collectplus.express.logic;

import java.util.ArrayList;
import java.util.HashMap;

public class AppResult<T> {
	private int status;
	private String message = "服务器异常";
	private T result;
	// 分页
	private int pageNum; // 当前页码
	private int pageSize;// 分页大小
	private int total;// 数据表的所有数据条数
	private int totalPage;// 总页数
	private ArrayList<T> resultList;// 结果列表
	private HashMap<String, T> resultMap; // 结果map

	/**
	 * 消息请求是否成功
	 *
	 * @return
	 */
	public boolean isSuccess() {
		return status == 1;
	}

	//
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public T getResult() {
		return result;
	}

	public void setResult(T result) {
		this.result = result;
	}

	public ArrayList<T> getResultList() {
		if (resultList == null) {
			resultList = new ArrayList<T>();
		}
		return resultList;
	}

	public void setResultList(ArrayList<T> resultList) {
		this.resultList = resultList;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public HashMap<String, T> getResultMap() {
		return resultMap;
	}

	public void setResultMap(HashMap<String, T> resultMap) {
		this.resultMap = resultMap;
	}
}
